<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>{$row.name}</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css"
          href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/zhaomu.css"/>
    <link rel="stylesheet" type="text/css"
          href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/questionnaire.css"/>
    <script type="text/javascript"
            src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/layer.js"></script>
    <link rel="stylesheet" type="text/css"
          href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/layer.css"/>
    <script src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/jquery.1.9.1.js"></script>
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script type="text/javascript"
            src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/rem.js"></script>
    <script type="text/javascript"
            src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css"
          href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.css"/>
    <style>
        .huoqu {
            border: none;
            outline: none;
            appearance: none;
            -wibkit-appearance: none;
        }

        .checkbox_label::before{
            display: inline-block;
            content: "";
            width: 0.32rem;
            height: 0.32rem;
            background: url(http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/checkbox.png) no-repeat;
            background-size: 100% 100%;
            margin-right: 6px;
            vertical-align: bottom;
        }
        input[type='checkbox']:checked+label::before{
            background: url(http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/checkboxed.png) no-repeat;
            background-size: 100% 100%;
        }
        .subject{margin-bottom: 5px;}
        .value{display: inline-block;width: 21%;}
        .dotm_btn1{font-size: 0.32rem;}
        #address{outline: none;appearance: none;-webkit-appearance: none;}
    </style>
</head>
<body class="body_tj">
<div id="tbh5v0">
    {if $dati == 0}
    <!--问卷开始-->
    <div id="wenjuanqqwe" style="display: block;">
        <img style="width: 100%;"
             src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/question_top4.jpg"/>
        <ul class="question">
            {foreach name="$info" item="vo"}
            <li>
                <p>{$key+1}. {$vo->name} {if $vo->must_fil == 1}<span style="color: #ff0000;">*</span>{/if}</p>
                <input type="hidden" id="wenjuan{$key}" value="{$vo->must_fil}"/>
                <input type="hidden" id="wenjuantype{$key}" value="{$vo->type}"/>
                {if $vo.type == 1}
                {foreach name="$vo->Datas" key="k" item="v" }
                <p>
                    <input type="radio" name="wenjuan{$key}" id="a{$key}{$k}"
                           value="{$vo->id}-{$v->name}-{$v->answer}"/>

                    <label class="radio-label" for="a{$key}{$k}"><span>{$v->name}.{$v->answer}</span></label>
                </p>
                {/foreach}
                {elseif $vo.type == 2}
                {foreach name="$vo->Datas" key="k" item="v" }
                <p>
                    <input type="checkbox" name="wenjuan{$key}" id="a{$key}{$k}"
                           value="{$vo->id}-{$v->name}-{$v->answer}"/>
                    <label class="checkbox-label" for="a{$key}{$k}"><span>{$v->name}.{$v->answer}</span></label>
                </p>
                {/foreach}
                {/if}
            </li>
            {/foreach}
        </ul>
        <div class="question_mid">
            <p class="mid_top">感谢您的答题！祝孩子考出最好的自己，高考成功！</p>
            <div>
                <p class="mid_mid">
                <p class="ktkj">提交问卷后</p>
                <p class="ktkj">查看《考前突破卷》纸质版样张</p>
                <span class="question_submit">点击领取纸质版</span>
                </p>
            </div>
        </div>

    </div>
    <script>
      var count = {:count($info)};
      var jsonData = {};
      $(function () {
        $('.question_submit').click(function () {
          for (var i = 0; i < count; i++) {
            var type = $("#wenjuantype" + i).val();
            console.log(type);
            if (type == 1) {
              var wenjuan = $("input[name='wenjuan" + i + "']:checked").val();
            } else if (type == 2) {
              var wenjuan = "";
              $("input[name='wenjuan" + i + "']:checked").each(function () {
                wenjuan += $(this).val() + "||";
              });
              if (wenjuan.length > 0) {
                wenjuan = wenjuan.substring(0, wenjuan.length - 2); //把最后一个逗号去掉
              }
              console.log(wenjuan);
            }
            var must_fil = $("#wenjuan" + i).val();

            if (must_fil == 1) {
              if (wenjuan == "" || wenjuan == null) {
                layer.open({
                  content: '请作答',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
            }
            jsonData['wenjuan' + i] = wenjuan;
          }
          console.log(jsonData);
          $.ajax({
            type: 'post',
            url: "/index/ques/volumepost/ids/{$row->id}",
            data: jsonData,
            success: function (data) {
              console.log(data);
              if (data.code == 0) {
                layer.open({
                  content: data.msg,//您未认真听讲或未认真答题，请重新答题
                  skin: 'msg',
                  time: 2,
                });
                return false;
              } else {
                layer.open({
                  content: data.msg,//您未认真听讲或未认真答题，请重新答题
                  skin: 'msg',
                  time: 2,
                });
                setTimeout(function(){
                    window.location.reload();
                }, 2000);

              }
            }
          });
        });
      });
    </script>
    <!--问卷结束-->
    {else}

    {if $edit}
        <!-- edit表单开始   -->
        <div class="addressmone" style="display: block;">
            <div class="question_mid">
                <img class="mid_img" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/question_mid2.jpg"/>
            </div>
            <ul>
                <li>
                    <p class="form_con">联系人 <span style="color: #ff0000;">*</span></p>
                    <input type="text" name="consignee" value="{$edit.name}" id="name"  >
                    <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_03.jpg"/>
                </li>
                <li>
                    <p class="form_con">联系电话 <span style="color: #ff0000;">*</span></p>
                    <input type="number" pattern="[0-9]*" name="" id="tel" value="{$edit.phone}" />
                    <img style="bottom: 0.9rem;" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_06.jpg"/>
                    <input style="width: 59%;" type="number" name="" id="code" pattern="[0-9]*" value="" />
                    <input type="button" class="huoqu" value="获取验证码">
                    <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_01.png"/>
                </li>
                <li style="position: relative;">
                    <p class="form_con">所在地区 <span style="color: #ff0000;">*</span></p>
                    <div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 100%;height: 35px;line-height: 35px;border-radius: 5px;overflow: hidden;">
                        <span style="color: #666;">请选择</span>
                    </div>
                    <img style="position: absolute;bottom: 0.3rem;left: 92%;width: 0.26rem;height: 0.13rem;" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/tj.png"/>
                    <input type="hidden" name="" id="sheng" value="" />
                    <input type="hidden" name="" id="shi" value="" />
                    <input type="hidden" name="" id="xian" value="" />
                </li>
                <li>
                    <p class="form_con">详细地址 <span style="color: #ff0000;">*</span></p>
                    <textarea name="address" id="address">{$edit.address}</textarea>
                </li>
                <li>
                    <p class="form_con">领取版本 <span style="color: #ff0000;">*</span></p>
                    <div style="margin-top: 5px;">
                        <input type="radio" name="type" id="radio1" value="全国版文" checked="checked" />
                        <label class="radio-labels" for="radio1"><span class="value">全国版文</span></label>
                        <input type="radio" name="type" id="radio2" value="全国版理" />
                        <label class="radio-labels" for="radio2"><span class="value">全国版理</span></label>
                        <input type="radio" name="type" id="radio3" value="浙江版" />
                        <label class="radio-labels" for="radio3"><span class="value">浙江版</span></label>
                    </div>
                    <div style="margin-top: 5px;">
                        <input type="radio" name="type" id="radio4" value="江苏版文 " />
                        <label class="radio-labels" for="radio4"><span class="value">江苏版文</span></label>
                        <input type="radio" name="type" id="radio5" value="江苏版理" />
                        <label class="radio-labels" for="radio5"><span class="value">江苏版理</span></label>
                    </div>
                    <div style="margin-top: 5px;">
                        <input type="radio" name="type" id="radio6" value="新高考版" />
                        <label class="radio-labels" for="radio6"><span class="value">新高考版</span></label>
                        <input type="radio" name="type" id="radio7" value="北京版 " />
                        <label class="radio-labels" for="radio7"><span class="value">北京版</span></label>
                    </div>
                </li>
                <li>
                    <p class="form_con subject">领取科目 <span style="color: #ff0000;">*</span></p>
                    <input type="checkbox" name="subject" id="yuwen" value="语文" />
                    <label class="checkbox_label" for="yuwen"><span class="value">语文</span></label>
                    <input type="checkbox" name="subject" id="shuxue" value="数学" />
                    <label class="checkbox_label" for="shuxue"><span class="value">数学</span></label>
                </li>

            </ul>

            <div class="dotm_btn">
                <input type="submit" value="纸质版领取需自付9元快递费用" class="dotm_btn1">
            </div>

        </div>
        <script type="text/javascript" charset="utf-8">
          wx.config({$jssdk});
        </script>
        <script>
            var id ='{$edit.id}';
          $(function(){
            var mobileSelect4 = new MobileSelect({
              trigger: '#trigger4',
              title: '地区选择',
              wheels: [{data:[
                  {
                    id:'1',
                    value:'',
                    childs:[
                      {id:'A1',value:''},
                    ]
                  }
                ]}],
              transitionEnd:function(indexArr, data){

              },
              callback:function(indexArr, data){
                console.log(data);
                $('#sheng').val(data[0].id);
                $('#shi').val(data[1].id);
                $('#xian').val(data[2].id);
              }
            });
            $.ajax({
              type: "get",
              url: "/api/ajax/area",
              dataType: "json",
              success: function(res){
                mobileSelect4.updateWheels(res.data);
              }
            });
            $('.huoqu').click(function() {
              var tel = $('#tel').val();
              if(!(/^1[3456789]\d{9}$/.test(tel))) {
                layer.open({
                  content: '请输入正确的手机号码',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              $.ajax({
                type: 'post',
                url:"/api/sms/send" ,
                data:{mobile:tel,event:'examiation'},
                success: function(data){
                  console.log(data);
                  if(data.code != 1){
                    layer.open({
                      content:data.msg ,
                      skin: 'msg',
                      time: 2 //2秒后自动关闭
                    });
                    return false
                  }else{
                    var count = 120;
                    const countDown = setInterval(() => {
                      if (count === 0) {
                        $('.huoqu').val('重新发送').removeAttr('disabled');
                        $('.huoqu').css({
                          background: '#f3494c',
                          color: '#fff',
                        });
                        clearInterval(countDown);
                      } else {

                        $('.huoqu').css({
                          background: '#eee',
                          color: '#333',
                        });
                        $('.huoqu').val(count + '秒后可重新获取');
                        $('.huoqu').attr('disabled', true);
                      }
                      count--;
                    }, 1000);
                  }
                }
              });
            });
            $('.dotm_btn1').click(function(){
              var sheng = $('#sheng').val();
              var shi = $('#shi').val();
              var xian = $('#xian').val();
              var code = $('#code').val();
              var name = $('#name').val();
              var tel = $('#tel').val();
              var address = $('#address').val();
              var type = $("input[name='type']:checked").val();
              var arr =[];
              $('input[name="subject"]:checked').each(function(){
                arr.push($(this).val());

              });
              var subject = arr.join();
              if(name == ""||name == null){
                layer.open({
                  content: '请填写姓名',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }

              if(!(/^1[3456789]\d{9}$/.test(tel))) {
                layer.open({
                  content: '请输入正确的手机号码',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(code == ""||code == null){
                layer.open({
                  content: '请填写验证码',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(sheng == ""||sheng == null){
                layer.open({
                  content: '请选择所在省份',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(shi == ""||shi == null){
                layer.open({
                  content: '请选择所在城市',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(address == ""||address == null){
                layer.open({
                  content: '请填写详细地址',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(type == ""|| type == null){
                layer.open({
                  content: '请选择领取版本',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(subject == ""|| subject == null){
                layer.open({
                  content: '请选择领取科目',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              var index = layer.open({type: 2});
              //验证验证码
              $.ajax({
                type: 'post',
                url:"/api/sms/check" ,
                data:{mobile:tel,captcha:code,event:'examiation'},
                success: function(data){
                  if(data.code == 0){
                    layer.close(index);
                    layer.open({
                      content: data.msg,
                      skin: 'msg',
                      time: 2,
                    });
                    return false;
                  }else{
                    //添加禁止标签
                    $('.dotm_btn1').attr("disabled","disabled");
                    //提交表单
                    $.ajax({
                      type: 'post',
                      url:"/api/Activity/guessedit/ids/"+id ,
                      data:{shen:sheng,shi:shi,xian:xian,name:name,phone:tel,type:type,address:address,subject:subject},
                      success: function(data){
                        console.log(data);
                        if(data.code == 0){
                          layer.close(index);
                          $('.dotm_btn1').attr("disabled","");
                          layer.open({
                            content: data.msg,
                            skin: 'msg',
                            time: 2,
                          });
                          return false;
                        }else{
                          layer.close(index);
                          wx.chooseWXPay({
                            timestamp: data.data.timeStamp,
                            nonceStr: data.data.nonceStr,
                            package: data.data.package,
                            signType: data.data.signType,
                            paySign: data.data.paySign, // 支付签名
                            success: function (res) {
                              // 支付成功后的回调函数
                              if (res.errMsg == "chooseWXPay:ok") {
                                // alert('支付成功');
                                window.location.href="http://tmall.fc62.com/zm_success.html";
                                // window.location.reload();
                                $('.dotm_btn1').removeAttr("disabled");
                              } else {
                                alert(res.errMsg,null);
                                $('.dotm_btn1').removeAttr("disabled");
                              }
                            },
                            cancel: function(r) {
                              alert('取消支付');
                              $('.dotm_btn1').removeAttr("disabled");
                            },
                            fail:function(r){
                              alert('fail支付失败了');
                              $('.dotm_btn1').removeAttr("disabled");
                              //支付失败
                            }

                          });

                        }

                      }
                    });
                  }

                }
              });
            });

          });
        </script>
        <!--  edit表单结束  -->
    {else}
        <!-- add表单开始   -->
        <div class="addressmone" style="display: block;">

            <div class="question_mid">
                <img class="mid_img" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/question_mid2.jpg"/>
            </div>
            <ul>
                <li>
                    <p class="form_con">联系人 <span style="color: #ff0000;">*</span></p>
                    <input type="text" name="consignee" value="" id="name" >
                    <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_03.jpg"/>
                </li>
                <li>
                    <p class="form_con">联系电话 <span style="color: #ff0000;">*</span></p>
                    <input type="number" pattern="[0-9]*" name="" id="tel" value="" />
                    <img style="bottom: 0.9rem;" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_06.jpg"/>
                    <input style="width: 59%;" type="number" name="" id="code" pattern="[0-9]*" value="" />
                    <input type="button" class="huoqu" value="获取验证码">
                    <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_01.png"/>
                </li>
                <li style="position: relative;">
                    <p class="form_con">所在地区 <span style="color: #ff0000;">*</span></p>
                    <div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 100%;height: 35px;line-height: 35px;border-radius: 5px;overflow: hidden;">
                        <span style="color: #666;">请选择</span>
                    </div>
                    <img style="position: absolute;bottom: 0.3rem;left: 92%;width: 0.26rem;height: 0.13rem;" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/tj.png"/>
                    <input type="hidden" name="" id="sheng" value="" />
                    <input type="hidden" name="" id="shi" value="" />
                    <input type="hidden" name="" id="xian" value="" />
                </li>
                <li>
                    <p class="form_con">详细地址 <span style="color: #ff0000;">*</span></p>
                    <textarea name="address" id="address"></textarea>
                </li>
                <li>
                    <p class="form_con">领取版本 <span style="color: #ff0000;">*</span></p>
                    <div style="margin-top: 5px;">
                        <input type="radio" name="type" id="radio1" value="全国版文" checked="checked" />
                        <label class="radio-labels" for="radio1"><span class="value">全国版文</span></label>
                        <input type="radio" name="type" id="radio2" value="全国版理" />
                        <label class="radio-labels" for="radio2"><span class="value">全国版理</span></label>
                        <input type="radio" name="type" id="radio3" value="浙江版" />
                        <label class="radio-labels" for="radio3"><span class="value">浙江版</span></label>
                    </div>
                    <div style="margin-top: 5px;">
                        <input type="radio" name="type" id="radio4" value="江苏版文 " />
                        <label class="radio-labels" for="radio4"><span class="value">江苏版文</span></label>
                        <input type="radio" name="type" id="radio5" value="江苏版理" />
                        <label class="radio-labels" for="radio5"><span class="value">江苏版理</span></label>
                    </div>
                    <div style="margin-top: 5px;">
                        <input type="radio" name="type" id="radio6" value="新高考版" />
                        <label class="radio-labels" for="radio6"><span class="value">新高考版</span></label>
                        <input type="radio" name="type" id="radio7" value="北京版 " />
                        <label class="radio-labels" for="radio7"><span class="value">北京版</span></label>
                    </div>
                </li>
                <li>
                    <p class="form_con subject">领取科目 <span style="color: #ff0000;">*</span></p>
                    <input type="checkbox" name="subject" id="yuwen" value="语文" />
                    <label class="checkbox_label" for="yuwen"><span class="value">语文</span></label>
                    <input type="checkbox" name="subject" id="shuxue" value="数学" />
                    <label class="checkbox_label" for="shuxue"><span class="value">数学</span></label>
                </li>



            </ul>

            <div class="dotm_btn">
                <input type="submit" value="纸质版领取需自付9元快递费用" class="dotm_btn1">
            </div>

        </div>
        <script type="text/javascript" charset="utf-8">
          wx.config({$jssdk});
        </script>
        <script>
          $(function(){
            var mobileSelect4 = new MobileSelect({
              trigger: '#trigger4',
              title: '地区选择',
              wheels: [{data:[
                  {
                    id:'1',
                    value:'',
                    childs:[
                      {id:'A1',value:''},
                    ]
                  }
                ]}],
              transitionEnd:function(indexArr, data){

              },
              callback:function(indexArr, data){
                console.log(data);
                $('#sheng').val(data[0].id);
                $('#shi').val(data[1].id);
                $('#xian').val(data[2].id);
              }
            });
            $.ajax({
              type: "get",
              url: "/api/ajax/area",
              dataType: "json",
              success: function(res){
                mobileSelect4.updateWheels(res.data);
              }
            });
            $('.huoqu').click(function() {
              var tel = $('#tel').val();
              if(!(/^1[3456789]\d{9}$/.test(tel))) {
                layer.open({
                  content: '请输入正确的手机号码',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              $.ajax({
                type: 'post',
                url:"/api/sms/send" ,
                data:{mobile:tel,event:'examiation'},
                success: function(data){
                  console.log(data);
                  if(data.code != 1){
                    layer.open({
                      content:data.msg ,
                      skin: 'msg',
                      time: 2 //2秒后自动关闭
                    });
                    return false
                  }else{
                    var count = 120;
                    const countDown = setInterval(() => {
                      if (count === 0) {
                        $('.huoqu').val('重新发送').removeAttr('disabled');
                        $('.huoqu').css({
                          background: '#f3494c',
                          color: '#fff',
                        });
                        clearInterval(countDown);
                      } else {

                        $('.huoqu').css({
                          background: '#eee',
                          color: '#333',
                        });
                        $('.huoqu').val(count + '秒后可重新获取');
                        $('.huoqu').attr('disabled', true);
                      }
                      count--;
                    }, 1000);
                  }
                }
              });
            });
            $('.dotm_btn1').click(function(){
              var sheng = $('#sheng').val();
              var shi = $('#shi').val();
              var xian = $('#xian').val();
              var code = $('#code').val();
              var name = $('#name').val();
              var tel = $('#tel').val();
              var address = $('#address').val();
              var type = $("input[name='type']:checked").val();
              var arr =[];
              $('input[name="subject"]:checked').each(function(){
                arr.push($(this).val());

              });
              var subject = arr.join();
              if(name == ""||name == null){
                layer.open({
                  content: '请填写姓名',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }

              if(!(/^1[3456789]\d{9}$/.test(tel))) {
                layer.open({
                  content: '请输入正确的手机号码',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(code == ""||code == null){
                layer.open({
                  content: '请填写验证码',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(sheng == ""||sheng == null){
                layer.open({
                  content: '请选择所在省份',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(shi == ""||shi == null){
                layer.open({
                  content: '请选择所在城市',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(address == ""||address == null){
                layer.open({
                  content: '请填写详细地址',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(type == ""|| type == null){
                layer.open({
                  content: '请选择领取版本',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              if(subject == ""|| subject == null){
                layer.open({
                  content: '请选择领取科目',
                  skin: 'msg',
                  time: 2 //2秒后自动关闭
                });
                return false;
              }
              var index = layer.open({type: 2});
              //验证验证码
              $.ajax({
                type: 'post',
                url:"/api/sms/check" ,
                data:{mobile:tel,captcha:code,event:'examiation'},
                success: function(data){
                  if(data.code == 0){
                    layer.close(index);
                    layer.open({
                      content: data.msg,
                      skin: 'msg',
                      time: 2,
                    });
                    return false;
                  }else{
                    //添加禁止标签
                    $('.dotm_btn1').attr("disabled","disabled");
                    //提交表单
                    $.ajax({
                      type: 'post',
                      url:"/api/Activity/guess" ,
                      data:{shen:sheng,shi:shi,xian:xian,name:name,phone:tel,type:type,address:address,subject:subject},
                      success: function(data){
                        console.log(data);
                        if(data.code == 0){
                          layer.close(index);
                          $('.dotm_btn1').attr("disabled","");
                          layer.open({
                            content: data.msg,
                            skin: 'msg',
                            time: 2,
                          });
                          return false;
                        }else{
                          layer.close(index);
                          wx.chooseWXPay({
                            timestamp: data.data.timeStamp,
                            nonceStr: data.data.nonceStr,
                            package: data.data.package,
                            signType: data.data.signType,
                            paySign: data.data.paySign, // 支付签名
                            success: function (res) {
                              // 支付成功后的回调函数
                              if (res.errMsg == "chooseWXPay:ok") {
                                // alert('支付成功');
                                window.location.href="http://tmall.fc62.com/zm_success.html";
                                // window.location.reload();
                                $('.dotm_btn1').removeAttr("disabled");
                              } else {
                                alert(res.errMsg,null);
                                $('.dotm_btn1').removeAttr("disabled");
                              }
                            },
                            cancel: function(r) {
                              alert('取消支付');
                              $('.dotm_btn1').removeAttr("disabled");
                            },
                            fail:function(r){
                              alert('fail支付失败了');
                              $('.dotm_btn1').removeAttr("disabled");
                              //支付失败
                            }

                          });

                        }

                      }
                    });
                  }

                }
              });
            });

          });
        </script>
        <!--  add表单结束  -->
    {/if}

    {/if}
</div>
</body>
</html>